export function formatTime(timestamp) {
    const currentTime = new Date();
    const targetTime = new Date(timestamp);
    const diffTime = currentTime - targetTime;
    
    const diffMinutes = Math.floor(diffTime / (1000 * 60));
    
    if (diffMinutes < 60) {
      return diffMinutes + '分钟前';
    } else if (diffMinutes < 24 * 60) {
      const diffHours = Math.floor(diffMinutes / 60);
      return diffHours + '小时前';
    } else if (diffMinutes < 48 * 60) {
      return '昨天';
    } else {
      const year = targetTime.getFullYear();
      const month = targetTime.getMonth() + 1;
      const day = targetTime.getDate();
      return year + '-' + month + '-' + day;
    }
  }